<template>
  <div class="containers">
    <div class="container">
      <el-descriptions class="margin-top" title="商家信息" :column="3"  border  v-loading="loading" size="mini">
        <template slot="extra" v-if="form.state == 2">
          <el-button type="primary" size="mini" @click="grounding(form.ID, 0)">同意</el-button>
          <el-button type="primary" size="mini" @click="jujue(form.ID, 1)">拒绝</el-button>
        </template>
        <template slot="extra" v-if="form.state == 1">
          <el-button type="primary" size="mini" @click="jujue(form.ID, 1)">下架</el-button>

        </template>
         <el-descriptions-item>
          <template slot="label">

            商家名称
          </template>
          {{ form.business.name }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            商家电话
          </template>
          {{ form.business.mobile }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            商家地址
          </template>
          {{ form.business.province+form.business.city+form.business.area+form.business.address}}
        </el-descriptions-item>

      </el-descriptions>
      <el-descriptions class="margin-top" title="商品信息" :column="3" style="margin-top:20px"  border v-loading="loading" size="mini">
        <el-descriptions-item>
          <template slot="label">

            商品名称
          </template>
          {{ form.name }}
        </el-descriptions-item>
         <el-descriptions-item>
          <template slot="label">

            商品分区
          </template>
          {{ navigation_list.filter(item=>item.ID==form.partition_id).length>0? navigation_list.filter(item=>item.ID==form.partition_id)[0].name:''  }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">

            一级分类
          </template>
          {{ firstlist.filter(item=>item.ID==form.class_first_id).length>0? firstlist.filter(item=>item.ID==form.class_first_id)[0].name :'' }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">

            二级分类
          </template>
          <div v-if="form.class_second_id!=0">
            {{secondlist.filter(item=>item.ID==form.class_second_id).length>0? secondlist.filter(item=>item.ID==form.class_second_id)[0].name :'' }}
          </div>
        </el-descriptions-item>
        <!-- <el-descriptions-item>
          <template slot="label">

            三级分类
          </template>
          <div v-if="form.class_third_id!=0">
            {{thirdlist.filter(item=>item.ID==form.class_third_id).length>0 ?thirdlist.filter(item=>item.ID==form.class_third_id)[0].name:''  }}
          </div>
        </el-descriptions-item> -->
        <!-- <el-descriptions-item>
          <template slot="label">
            三级分类
          </template>
          <div >
            {{['普通','百元区','千元区','万元区'][form.is_single] }}
          </div>
        </el-descriptions-item> -->

        <el-descriptions-item>
          <template slot="label">

            商品简介
          </template>
          <div v-if="form.title">
            {{ form.title  }}
          </div>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">

            商品价格
          </template>
          <div v-if="form.price">
            {{ form.price  }}
          </div>
        </el-descriptions-item>
        <!-- <el-descriptions-item>
          <template slot="label">

            市场价格
          </template>
          <div v-if="form.market">
            {{ form.market  }}
          </div>
        </el-descriptions-item> -->
        <el-descriptions-item>
          <template slot="label">

            商品库存
          </template>
          <div v-if="form.stock">
            {{ form.stock  }}
          </div>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">

            商品销量
          </template>
          <div v-if="form.sales">
            {{ form.sales }}
          </div>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">

            商品虚拟销量
          </template>
          <div v-if="form.virtually_sales">
            {{ form.virtually_sales  }}
          </div>
        </el-descriptions-item>

        <!-- <el-descriptions-item>
          <template slot="label">

            商品排序
          </template>
          <div v-if="form.sort">
            {{ form.sort  }}
          </div>
        </el-descriptions-item> -->

        <el-descriptions-item>
          <template slot="label">

            会员让利（%）
          </template>
          <div v-if="form.discount">
            {{ form.discount  }}
          </div>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">

            平台让利（%）
          </template>
          <div v-if="form.platform_discount">
            {{ form.platform_discount  }}
          </div>
        </el-descriptions-item>
        <!-- <el-descriptions-item>
          <template slot="label">

            赠送nft
          </template>
          <div v-if="form.nft_card_num">
            {{ form.nft_card_num  }}
          </div>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">

            赠送消费金
          </template>
          <div v-if="form.balance_send">
            {{ form.balance_send  }}
          </div>
        </el-descriptions-item> -->

        <el-descriptions-item>
          <template slot="label">

            资质
          </template>
          <div v-if="form.material">
            <!-- <img v-if="form.material" :src="form.material" class="avatar"> -->
            <el-image class="table-td-thumb" style="height: 60px;width: 60px;" :src="form.material" :preview-src-list="[form.material]"></el-image>
          </div>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">

            展示图片
          </template>
          <div v-if="imageUrl">
            <el-image class="table-td-thumb" style="height: 60px;width: 60px;" :src="imageUrl" :preview-src-list="[imageUrl]"></el-image>
          </div>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">

            展示视频
          </template>
          <div v-if="videoUrl">
            <video v-if="videoUrl" :src="videoUrl" class="avatar" />
          </div>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">

            轮播图
          </template>
          <div v-if="filelist.length" style="display:flex;">
            <!-- <img v-for="(item,idnex) in filelist" :src="item.url" class="avatar"> -->

            <el-image  v-for="(item,idnex) in filelist" :key="idnex" class="table-td-thumb" style="height: 60px;width: 60px;margin-right: 10px;" :src="item.url" :preview-src-list="[item.url]"></el-image>
          </div>
        </el-descriptions-item>



      </el-descriptions>
      <div style="margin-top:20px;font-weight: bold;margin-bottom: 20px;" v-if="attrpricetable.length > 0 && attrubutetable.length > 0">规格</div>
      <el-table :data="attrpricetable" v-if="attrpricetable.length > 0 && attrubutetable.length > 0" border v-loading="loading" size="mini"
        class="table" ref="multipleTable" header-cell-class-name="table-header">
        <el-table-column :prop="i.type_name" :label="i.type_name" v-for="(i, inde) in attrubutetable"
          :key="inde" header-align="center" min-width="80" align="center">
          <template slot-scope="scope" v-if="scope.row.attr[inde]">
            {{ scope.row.attr[inde].val }}
          </template>
        </el-table-column>
        <el-table-column prop="type_name" label="价格" header-align="center" min-width="80" align="center">
          <template slot-scope="scope">
            {{scope.row.price}}
          </template>
        </el-table-column>
        <el-table-column prop="type_name" label="库存" header-align="center" min-width="80" align="center">
          <template slot-scope="scope">
            {{scope.row.stock}}
          </template>
        </el-table-column>

        <el-table-column prop="type_name" label="展示图" header-align="center" min-width="150"
          align="center">
          <template slot-scope="scope">
            <img @click="sss(scope.$index)" v-if="form.img || scope.row.img"
                :src="scope.row.img ? scope.row.img : form.img" style="width: 50px;height: 50px;" />
          </template>
        </el-table-column>
      </el-table>
      <div v-if="form.details" style="margin-top:20px;font-weight: bold;margin-bottom: 20px;">商品详情</div>
      <div v-if="form.details" v-html="form.details" style="overflow-y: scroll;"></div>
    </div>
  </div>
</template>

<script>
import MyEditor from '@/components/MyEditor.vue'
export default {
  name: 'addgoods',
  components: {
    MyEditor
  },
  data() {
    return {
      options:[],
      price: '',
      select: false,
      isselect: false,
      upimg: {
        token: '',
        key: new Date().valueOf()
      },
      upload: '',
      url: '',
      imageUrl: '',
      videoUrl: '',
      thisrow: {},
      images: [],
      showdetails: true,
      activeName: '1',
      navigation_list: [], //分区
      firstlist: [], //分类
      secondlist: [],
      filelist: [],
      thirdlist: [],
      attrlist: [], // 属性列表
      attrubutetable: [], //'属性表'
      attrpricetable: [], //属性价格表
      dialogImageUrl: '',
      baodan: true,
      index: 0,
      dialogVisible: false,
      form: {
        name: '',//商品名称
        img: '',//首页展示图
        details: '',//商品介绍
        class_first_id: '',
        class_second_id: '',
        class_third_id: '',
        business_class_id: 0,
        img_list: [],
        freight:'',
        stock: 0,
        sales: 0,
        coupon: 0,
        price: 0,
        video: '',
        market: 0,
        is_extension: 0,
        is_hot: 0,
        is_index: 0,
        sort:0,
        partition_id: '',
        title: '',
        attribute_list: [],
        state:1,
        discount:0,//折扣
        business:{
          name:'',
          mobile:'',
          address:'',
          area:'',
          city:''
        }
      },
      addstate:true,
      loading:true
    };
  },
  activated() {
  },
  created() {
    this.getToken().then(res => {
      this.upimg.token = res.data.token
      this.url = res.data.url
      this.upload = res.data.upload
    },
      function () {
        console.log('请求失败处理');
      }
    )
    this.init()
    try {
      console.log(this.$route.query.id)
      if (this.$route.query.id) {
        this.getData()
        this.addstate=false
      }
    } catch {

    }
  },
  methods: {
    getData() {
      this.loading = true
      this.request('admin/goodsDetails/', 'post', { id: Number(this.$route.query.id) }).then(res => {
        this.loading = false
        this.form = res.data
        console.log(this.form,'xxxxx')
        this.imageUrl = res.data.img
        this.filelist= eval('(' +  res.data.img_list + ')').map(item=>{//重构轮播
          return {
            name:item,
            url:item
          }
        })
        this.form.img_list =eval('(' + res.data.img_list + ')') //重构轮播
        this.form.class_first_id = res.data.class_first_id
        this.form.partition_id = res.data.partition_id ? res.data.partition_id : ''
        this.form.freight=res.data.freight ? res.data.freight : ''
        this.request('admin/add_attribute/', 'get', { page: 1, size: 100 }).then(ress => {
          this.attrlist = ress.data
          console.log(this.attrlist)
          //规格
          let attr = []
          let attrubutetable = []
          //处理商品规格
          res.data.attribute_list[0].attr.forEach((item,index)=>{
            attrubutetable[index]=[]
          })
          res.data.attribute_list.forEach((item, index) => {

            item.attr.forEach((items, indexs) => {
              let attrlist = this.attrlist.filter(i => {
                return items.attr == i.type_name
              })[0].type_attr.map(k => {
                return k.val
              })
              attrubutetable[indexs] = {
                type_name: items.attr,
                index:this.attrlist.findIndex(is=>is.type_name==items.attr),
                attrindexlist: attrlist,
              }
            })
            let attrs = item.attr.map(items => {
              return {
                attr: items.attr,
                val: items.val
              }
            })
            attr.push({
              attr: attrs,
              attrcash_coupon: 0,
              price: item.price,
              img: item.img,
              stock: item.stock,
              supply:item.supply,
              pv:item.pv,
              coupon:item.coupon
            })
          })
          //处理商品规格
          let list = []
          let lists = []
          attr.forEach((item, index) => {
            list[index] =new Array
            item.attr.forEach((items, indexs) => {
              lists[indexs] = new Array
              console.log(indexs)
            })
          })
          attr.forEach((item, index) => {
            item.attr.forEach((items, indexs) => {
              list[index].push(items.val) //= [...list[indexs], items.val]
            })
          })
          for (var k = 0; k < lists.length; k++) {
            console.log(k)
            list.forEach((item, index) => {
              console.log('+++++++', index,item)
              lists[k].push(item[k]);
            })
          }
          lists.forEach((item, index) => {
            let listbox = []
            attrubutetable[index].attrindexlist.forEach((items, indexs) => {
              listbox.push(items == item[indexs] ? 1 : 0)
            })
            attrubutetable[index].attrindexlist = listbox
          })
          this.attrubutetable = attrubutetable
          this.attrpricetable = attr
          if (res.data.class_first_id > 0) {//获取二级分类
            console.log( this.form.class_second_id,res.data.class_second_id,'++++++++++++++',this.form.class_third_id)
            this.form.class_second_id = res.data.class_second_id!=0?res.data.class_second_id:''
            this.request('admin/secondClass/', 'get', { class_first_id: this.form.class_first_id, page: 1, size: 100, keyword: '' }).then(res => {
              this.secondlist = res.data.data
            })
          }else{
            this.form.class_second_id = ''
          }
          if (res.data.class_second_id > 0) {//获取三级分类
            this.form.class_third_id = res.data.class_third_id
            this.request('admin/thirdClass/', 'get', { class_second_id: this.form.class_second_id, page: 1, size: 100, keyword: '' }).then(res => {
              this.thirdlist = res.data.data
            })
          }else{
            this.form.class_third_id = ''
          }

        })


        console.log('form',this.form)
      })
    },
    //获取初始化
    init() {
      //获取运费模版
      this.request('admin/freightTemplate/', 'get', { page: 1, size: 50}).then(res => {
				this.options=res.data.data
			})
    //获取一级分类
      this.request('admin/firstClass/', 'get', { page: 1, size: 100, keyword: '' }).then(res => {
        this.firstlist = res.data.data
      })
    //获取商品分区
      this.request('admin/partition/', 'get', { page: 1, size: 100 }).then(res => {
        console.log(res)
        this.navigation_list = res.data.data
      })
    },
    //获取2级分类
    // setfirst() {
    //   this.form.class_second_id = ''
    //   this.request('admin/secondClass/', 'get', { class_first_id: this.form.class_first_id, page: 1, size: 100, keyword: '' }).then(res => {
    //     this.secondlist = res.data.data
    //   })
    // },
    //获取3级分类
    // setsecond() {
    //   this.form.class_third_id = ''
    //   this.request('admin/thirdClass/', 'get', { class_second_id: this.form.class_second_id, page: 1, size: 100, keyword: '' }).then(res => {
    //     this.thirdlist = res.data.data
    //   })
    // },



    getContent(e) {
      console.log('editor', e)
      this.form.details = e
    },

    // 编辑商品
    sss(s) {
      this.index = s;
    },


    //一键填写价格
    autoprice() {
      for (var i = 0, len = this.attrpricetable.length; i < len; i++) {
        this.attrpricetable[i].price = this.form.price;
      }
    },


    //一键填写库存
    autostock() {
      for (var i = 0, len = this.attrpricetable.length; i < len; i++) {
        this.attrpricetable[i].stock = this.form.stock;
      }
    },
    //拒绝
    jujue(id, code) {
      this.$prompt('请输入拒绝原因', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
      }).then(({ value }) => {
        this.request('admin/businessGoodsList/', 'DELETE', { id: id, reason: value, code: code }).then(res => {
          if (res.errno == 0) {
            this.$message.success(res.errmsg);
          } else {
            this.$message.error(res.errmsg);
          }
        });
        setTimeout(() => {
          this.getData();
        }, 500);
      }).catch(() => {

      });

    },
    //点击属性按钮
    clickattr(row, index) {
      row.attrindexlist[index] = row.attrindexlist[index] == 1 ? 0 : 1;
      this.attrlist[row.index].type_attr.push(1);
      this.attrlist[row.index].type_attr.pop();
      this.drawtable(); // 改变属性重新绘制绘制表格
    },
    //绘制属性价格表
    drawtable() {
      this.attrpricetable = [];
      let cpa = this.getattrprice(); //组合函数
      console.log("测试规格1", cpa)
      console.log("测试规格2", this.attrubutetable)
      for (var k = 0; k < cpa.length; k++) {
        var newarr = [];
        console.log(cpa[k])
        for (var i = 0; i < cpa[k].length; i++) {
          console.log(cpa[k][i])
          newarr.push({
            attr: this.attrubutetable[i].type_name,
            val: cpa[k][i].val
          });
        }
        this.attrpricetable.push({
          attr: newarr,
          coupon: 0,
          price: 0,
          cash_coupon: 0,
          img: '',
          stock: 0
        });
      }
    },
    //添加规格按钮
    addattrubut() {
      this.attrubutetable.push({
        type_name: '请选择属性',
        index: -1
      });
    },
    // 删除规格按钮
    deleteattr(row) {
      console.log(this.attrubutetable)
      this.attrubutetable = this.attrubutetable.filter(t => t.type_name != row.type_name);
      console.log(this.attrubutetable)
      this.drawtable(); // 改变属性重新绘制绘制表格
    },
    // 删除单行属性
    deletpraci(row) {
      this.attrpricetable = this.attrpricetable.filter(t => t != row);
      // console.log(this.attrpricetable)
    },
    addnewattr() {
      // this.$router.push({
      //   path: '/attributelist'
      // });
    },
    //选择属性类别
    shooseattr(row) {
      console.log(row)
      let index = 0;
      let p = this.attrubutetable.filter(t => t.type_name == row.type_name);
      if (p.length > 1) {
        row.type_name = '';
        return this.$message.error('不能选择相同属性');
      }

      for (var i = 0; i < this.attrlist.length; i++) {
        if (this.attrlist[i].type_name == row.type_name) {
          index = i;
          break;
        }
      }
      for (var i = 0; i < this.attrubutetable.length; i++) {
        if (this.attrubutetable[i].type_name == row.type_name) {
          this.attrubutetable[i].index = index;
          break;
        }
      }
      this.attrubutetable[i].attrindexlist = [];
      this.attrlist[i].type_attr.forEach(f => {
        this.attrubutetable[i].attrindexlist.push(0);
      });
    },


    handlePictureCardPreview(res, file) {
      this.dialogImageUrl = this.url + res.key;
      this.dialogVisible = true;
    },

    handleRemove(res, file) {
      this.filelist=file
      this.form.img_list=file.map(item=>{
        return item.url
      })
    },



    async beforeAvatarUpload(file) {
      if (file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'video/mp4') {
        this.$message.error('上传头像图片只能是 JPG、PNG 格式!');
        return false;
      }
      // if (file.size / 1024*1024> 500 && file.type !== 'video/mp4') {
      // 	this.$message.error('上传图标大小不能超过 500k!');
      // 	return false;
      // }
      let types = file.name.split('.')//获取视频格式
      this.upimg.key = this.$name + '/home/' + new Date().valueOf() + '.' + types[types.length - 1];

    },
    // 上传图片
    handleAvatarSuccess(res, file) {
      this.form.img = this.url + res.key;
      this.imageUrl = URL.createObjectURL(file.raw);
    },
    beforeupload(file) {
      if (file.type !== 'image/jpeg' && file.type !== 'image/png') {
        this.$message.error('上传头像图片只能是 JPG、PNG 格式!');
        return false;
      }
      if (file.size / 1024 / 1024 > 1) {
        this.$message.error('上传图标大小不能超过 1M!');
        return false;
      }
      let types = file.name.split('.')//获取图片格式
      this.upimg.key = 'template/home/' + new Date().valueOf() + '.' + types[types.length - 1];
    },
    // 上传视频
    handleAvatarSuccesss(res, file) {
      this.form.video = this.url + res.key;
      this.videoUrl = URL.createObjectURL(file.raw);
    },
    beforeuploads(file) {
      if (file) {
        if (file.type !== 'video/mp4') {
          this.$message.error('请上传视频格式');
          return false;
        }
        if (file.size / 1024 > 10240) {
          this.$message.error('上传视频大小不能超过 10240k!');
          return false;
        }
      }
      let types = file.name.split('.')//获取视频格式
      this.upimg.key = this.$name + '/home/' + new Date().valueOf() + '.' + types[types.length - 1];
    },
    someSuccess(res, file) {
      console.log(this.url + res.key,this.form.img_list)
      this.form.img_list.push(this.url + res.key);
      this.filelist.push({
        name: res.key,
        url: this.url + res.key
      })

    },
    handSuccessmore(res, file, files) {
      this.attrpricetable[this.index].img = this.url + res.key;
      this.thisrow.img = this.url + res.key;
    },
    //表单验证
    FormValidation() {
      let data = this.form;
      this.form.attribute_list = []
      this.attrpricetable.forEach(item => {
        item.price = Number(item.price)
        item.stock = Number(item.stock)

        if (!item.img) {
          item.img = this.form.img
        }
        this.form.attribute_list.push(item)
      })
      console.log(data)
      if (!data.name) {
        this.$message.error('请输入商品名称');
        return false;
      }
      if (!data.partition_id>0) {
        this.$message.error('请选择商品分区');
        return false;
      }
      if (!data.class_first_id>0) {
        this.$message.error('请选择商品一级分类');
        return false;
      }
      // if (!data.freight) {
      //   this.$message.error('请选择运费模版');
      //   return false;
      // }

      if (!data.title) {
        this.$message.error('请输入商品简介');
        return false;
      }
      if (!data.price>0) {
        this.$message.error('请输入商品价格');
        return false;
      }
      if (!data.img) {
        this.$message.error('请上传商品展示图片');
        return false;
      }
      console.log(this.filelist)
      if (this.filelist.length==0) {
        this.$message.error('请上传商品轮播图片');
        return false;
      }
      if (this.form.attribute_list.length==0) {
        this.$message.error('请选择商品规格');
        return false;
      }
      if (this.form.attribute_list.filter(item=>item.price>0).length==0) {
        this.$message.error('规格价格需大于0');
        return false;
      }

      return true;
    },
    //同意上架
    grounding(id, code) {
      this.request('admin/businessGoodsList/', 'DELETE', { id: id, code: code }).then(res => {
        if (res.errno == 0) {
          this.$message.success(res.errmsg);
        } else {
          this.$message.error(res.errmsg);
        }
        setTimeout(() => {
          this.getData();
        }, 500);
      });
    },
    onSubmit() {
      let that=this
      if (!this.FormValidation()) return;
      let data=this.form
      data.name= this.form.name,//商品名称
      data.img= this.form.img,//首页展示图
      data.details= this.form.details,//商品介绍
      data.class_first_id=this.form.class_first_id,
      data.class_second_id= this.form.class_second_id>0?this.form.class_second_id:0,
      data.class_third_id= this.form.class_third_id>0?this.form.class_third_id:0,
      data.img_list= JSON.stringify(this.form.img_list),
      data.stock=  Number(this.form.stock),
      data.sales=  Number(this.form.sales),
      data.coupon=  Number(this.form.coupon),
      data.price= Number(this.form.price),
      data.video=  this.form.video,
      data.market= Number(this.form.market),
      data.is_extension= Number(this.form.is_extension),
      data.is_hot=  Number(this.form.is_hot),
      data.is_index=  Number(this.form.is_index),
      data.sort=Number(this.form.sort),
      data.partition_id= this.form.partition_id,
      data.title= this.form.title,
      data.attribute_list= this.form.attribute_list
      data.state=Number(this.form.state)
      data.discount=Number(this.form.discount)

      data.freight=Number(this.form.freight)

      // if (this.$route.query.id) {
      //   data['id']=this.$route.query.id
      // }
      this.request('admin/add_goods/', this.addstate?'post':'PUT', data).then(res => {
        console.log(res)

        if(res.errno==0){
          this.$message.success(res.errmsg);
            setTimeout(f => {
              that.$router.push({ path: '/commodity/goodslist'})
            }, 500);
        }else{
          data.img_list=  eval('('+this.form.img_list+')')
          this.$message.error(res.errmsg);
        }
      })

    },

    // 工具函数
    doCombination(arr) {
      //排列组合算法
      var count = arr.length - 1;
      var tmp = [];
      var totalArr = [];

      function doCombinationCallback(arr, curr_index) {
        for (var val of arr[curr_index]) {
          tmp[curr_index] = val;
          if (curr_index < count) {
            doCombinationCallback(arr, curr_index + 1);
          } else {
            totalArr.push(tmp);
          }
          var oldTmp = tmp;
          tmp = [];
          for (var index of oldTmp) {
            tmp.push(index);
          }
        }
        return totalArr;
      }
      return doCombinationCallback(arr, 0);
    },

    getattrprice() {
      var arr = [];
      this.attrubutetable.forEach(f => {
        var b = [];
        if (f.index > -1) {
          for (var i = 0; i < f.attrindexlist.length; i++) {
            if (f.attrindexlist[i] == 1) {
              b.push(this.attrlist[f.index].type_attr[i]);
            }
          }
        }
        if (b.length > 0) {
          arr.push(b);
        }
      });
      return arr.length == 0 ? [] : this.doCombination(arr);
    },

  }
};
</script>
<style scoped="scoped">
.activeattr {
  border: 1px solid rgb(64, 158, 255);
  color: rgb(64, 158, 255);
}

.avatar {
  width: 100%;
  height: 100%;
}

.el-upload {
  width: 100px !important;
  height: 100px !important;
}

.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader .el-upload:hover {
  border-color: #409EFF;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 148px;
  height: 148px;
  line-height: 148px;
  text-align: center;
  border: 1px dashed #c0ccda;
  background-color: #fbfdff;
  border-radius: 6px;
}

.avatar {
  width: 148px;
  height: 148px;
  display: block;
}
/* 使用 /deep/ 或 >>> 来穿透 scoped 样式 */
::v-deep .el-table th.el-table__cell {
  background-color: #f2f2f2;
  /* 设置表头颜色 */
  color: #333;
  /* 设置表头文字颜色 */
}

</style>
